﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using HA.ModFlow.Domain.DomainLayer;
namespace HA.ModFlow.Controls.Windows
{
    /// <summary>
    /// winSIPConfig.xaml 的交互逻辑
    /// </summary>
    public partial class winSIPConfig : Window
    {
        public winSIPConfig(ModFlowData mfData)
        {
            InitializeComponent();

            labelHCLOSE.Content += "(" + Domain.DomainLayer.UnitConverter.GetLength(mfData.ModelOption.Units.Length) + "):";

            this._sipSolver = (SIPSolver)mfData.SipSolver.Clone();


            this.chkIPCALCUserSpecifedC.Click += new RoutedEventHandler(chkIPCALCUserSpecifedC_Click);
            this.chkIPCALCUserSpecifedU.Click += new RoutedEventHandler(chkIPCALCUserSpecifedC_Click);
        }

        void chkIPCALCUserSpecifedC_Click(object sender, RoutedEventArgs e)
        {
            if ((bool)this.chkIPCALCUserSpecifedU.IsChecked)
            {
                this.txtWSEED.IsEnabled = true;
            }
            else
            {
                this.txtWSEED.IsEnabled = false;
            }
        }

        SIPSolver _sipSolver;

        public SIPSolver SipSolver
        {
            get { return _sipSolver; }
           
        }  
    


        private void btnOk_Click(object sender, RoutedEventArgs e)
        {
            this.DialogResult = true;
            this.Close();
        }

        private void btnCancal_Click(object sender, RoutedEventArgs e)
        {
            this.Close();
        }

        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            grid.DataContext = this._sipSolver;

            if (this._sipSolver.IPCALCUserSpecifed)
            {
                this.chkIPCALCUserSpecifedU.IsChecked = true;
            }
            else
            {
                this.chkIPCALCUserSpecifedC.IsChecked = true  ;
            }
            chkIPCALCUserSpecifedC_Click(sender, e);
        }

       
    }
}
